
# use Smart::Comments;
use Data::Dumper qw(Dumper);
use Getopt::Long qw(GetOptions);

my @libs    = (); 
my %flags   = (); 
my ( $verbose, $all, $more, $diam, $debug, $test, $step);

GetOptions(
        'verbose+'  => \$verbose,
        'more!'     => \$more,
        'debug:i'   => \$debug,
        'lib=s'     => \@libs,
        'flag=s'    => \%flags,
        'test|t=s'    => \$test,
        # 'all|everything|universe' => $all,
);

print "verbose: $verbose \n" if(defined($verbose));
print "more: $more \n" if(defined($more));
print "debug: $debug \n" if(defined($debug));
print "libs: @libs \n" if(defined(\@libs));

if(defined(\%flags)) {
    print "flags:\n";
    print "$_ => $flags{$_}\n" for keys %flags;
}

print "test: $test \n" if(defined($test));
print "all: $all \n" if(defined($all));

print Dumper \@ARGV;

# reference : https://zhuanlan.zhihu.com/p/621583494

# perl getopt2.pl --verbose --verbose -v --more --lib='/lib' -l '/lib64' --f a=1 --flag b=2 --debug 2 -t fukai a.txt b.txt
# verbose: 3 
# more: 1 
# debug: 2 
# libs: /lib /lib64 
# flags:
# a => 1
# b => 2
# test: fukai 
# $VAR1 = [
#           'a.txt',
#           'b.txt'
#         ];

